#! /usr/bin/python
# coding: UTF-8
__author__ = 'root'
import MySQLdb

conn=None
dbconfig = {'host':'localhost',
            'user':'root',
            'passwd':'',
            'db':'bus',
            'unix_socket':'/opt/lampp/var/mysql/mysql.sock',
            'use_unicode':True,
            'charset':'utf8',
            'connect_timeout':500
}
def GetConn():
    global conn
    if not conn:
        conn = MySQLdb.connect(**dbconfig)
    return conn

def CloseConn():
    global conn
    if not conn:
        conn.close()
        conn = None
